import axios from "../plugin/http";

//创建投票结果
export function createVoteResult(payload) {
  //payload._id 为vote的id
  return axios
    .post(`/api/result/${payload.id}`, {
      "header": {
        "sysCode": "VOTE_SERVICE",
        "platform": window.navigator.platform,
        "timestamp": new Date().getTime()
      },
      "payload": {
        "selected": payload.selected // [22] 为option选项id数组
      }
    })
}

//获取投票结果
export function getVoteResultById(payload) {
  //payload._id 为vote的id
  return axios
    .get(`/api/result/${payload.id}`)
}

